/* @(#)GSManufactureCategoryModifyAction.java    V0.1
 *
 * Project: GSdevelop
 *
 * Modify Information:
 * =============================================================================
 *   Author       Date       Description
 *   ------------ ---------- ---------------------------------------------------
 *   owen         2006-2-28
 *
 * Copyright Notice:
 * =============================================================================
 *    Copyright (c) 2001-2006 Beijing HiTRUST Technology Co., Ltd. 1808 Room, 
 *        Science & Technology Building, No. 9 South Street, Zhong Guan Cun, 
 *        Haidian District, Beijing ,100081, China All rights reserved.
 *
 *    This software is the confidential and proprietary information of
 *        Beijing HiTRUST Technology Co., Ltd. ("Confidential Information").
 *        You shall not disclose such Confidential Information and shall use it
 *        only in accordance with the terms of the license agreement you entered
 *        into with HiTRUST.
 *
 * Warning:
 * =============================================================================
 * 
 */
package com.hitrust.gs.action;

import java.util.HashMap;

import org.apache.commons.beanutils.BeanUtils;

import system.LoginContext;

import client.XMLSend;

import com.hitrust.gs.bean.GSManufactureCategoryBean;
import com.hitrust.gs.business.GSManufactureCategoryProcessor;
import com.hitrust.gs.form.GSManufactureCategoryModifyForm;
import com.hitrust.gs.lib.GSBaseConstants;
import com.hitrust.gs.service.GSBaseAction;
import com.hitrust.gs.service.GSBaseForm;
import com.hitrust.gs.service.GSBaseManager;
import com.hitrust.gs.util.exception.GSException;

/**
 * 
 */
public class GSManufactureCategoryModifyAction extends GSBaseAction{

    public String execute(GSBaseForm aForm) throws Exception {
        GSManufactureCategoryModifyForm tForm = (GSManufactureCategoryModifyForm)aForm;
        GSManufactureCategoryBean tGSManufactureCategoryBean=new GSManufactureCategoryBean();
        try{
        
        BeanUtils.copyProperties(tGSManufactureCategoryBean,tForm);
        tGSManufactureCategoryBean.setGs_manufacture_category_id1(tForm.getGs_upper_manufacture_category1());
        tGSManufactureCategoryBean.setGs_manufacture_category_id2(tForm.getGs_upper_manufacture_category2());
        LoginContext loginContext=(LoginContext) aForm.getSession().getAttribute(GSBaseConstants.LOGIN);
        GSManufactureCategoryProcessor.modifyTask(tGSManufactureCategoryBean,loginContext);
        }
        catch (GSException err) {
            if(err.getCode() != null ) { 
                HashMap tMap = new HashMap();
                tMap.put("err",err.getMessage());
                aForm.getRequest().setAttribute("_error",tMap);
                aForm.getRequest().setAttribute("message",err.getMessage());
                aForm.getRequest().setAttribute("exception_code",err.getCode());
                aForm.getRequest().setAttribute("requery","true");
                throw new GSException(err.getMessage());
            } 
        }
        if (XMLSend.getInstance().isToRong()) {
            String actionName = "SubmitMaterialType";
            String dataName = "MaterialType";
            // 传输xml to 荣爱
            XMLSend.getInstance().submitMaterialTypeSendXML(actionName, dataName, tGSManufactureCategoryBean);

        }
        aForm.getRequest().setAttribute("message", "产品分类信息修改成功!");
        
        aForm.getRequest().setAttribute("requery","true");
        return GSBaseConstants.FORWARD_SUCCESS;
    }

}
